<script lang="ts" setup>
import { ref } from 'vue';
import useStore from '@/store/index';
const cate = useStore().category;
const obj = defineProps<{
  id: string;
}>();
cate.getTopCate(obj.id);
</script>

<template>
  <div class="topCart">
    <h2>全部分类</h2>
    <div class="fullSort">
      <div class="item" v-for="item in cate.topSortList" :key="item.id">
        <router-link :to="`/Category/sub/${item.id}`">
          <div class="pic"><img :src="item.picture" alt="" /></div>
          <div class="info">{{ item.name }}</div></router-link
        >
      </div>
    </div>
  </div>
</template>
<style lang="less">
.topCart {
  margin-top: 20px;
  text-align: center;
  background-color: #fff;
  h2 {
    line-height: 100px;
    color: #666;
    font-size: 28px;
    font-weight: 400;
    margin: 0px;
  }
  .fullSort {
    padding: 0 32px;
    height: 160px;
    display: flex;
    .item {
      &:hover {
        .info {
          color: #27ba9b;
        }
      }
      width: 168px;
      .pic {
        img {
          width: 100px;
          height: 100px;
        }
      }
      .info {
        line-height: 40px;
        font-size: 16px;
        color: #333;
      }
    }
  }
}
</style>
